Setup the packages
library(rgdal)
## 載入需要的套件:sp
## Please note that rgdal will be retired by the end of 2023,
## plan transition to sf/stars/terra functions using GDAL and PROJ
## at your earliest convenience.
##
## rgdal: version: 1.5-27, (SVN revision 1148)
## Geospatial Data Abstraction Library extensions to R successfully loaded
## Loaded GDAL runtime: GDAL 3.2.1, released 2020/12/29
## Path to GDAL shared files: C:/Users/Lucian/Documents/R/win-library/4.1/rgdal/gdal
## GDAL binary built with GEOS: TRUE
## Loaded PROJ runtime: Rel. 7.2.1, January 1st, 2021, [PJ_VERSION: 721]
## Path to PROJ shared files: C:/Users/Lucian/Documents/R/win-library/4.1/rgdal/proj
## PROJ CDN enabled: FALSE
## Linking to sp version:1.4-5
## To mute warnings of possible GDAL/OSR exportToProj4() degradation,
## use options("rgdal_show_exportToProj4_warnings"="none") before loading sp or rgdal.
## Overwritten PROJ_LIB was C:/Users/Lucian/Documents/R/win-library/4.1/rgdal/proj
library(leaflet)
Get the map data
Taiwan <- readOGR("D:/R/Ecological Data Analysis in R/Sample Data/20211109_Taiwan/COUNTY_MOI_1090820.shp",
use_iconv = TRUE, encoding = 'UTF-8')
## Warning in OGRSpatialRef(dsn, layer, morphFromESRI = morphFromESRI, dumpSRS =
## dumpSRS, : Discarded datum Taiwan_Datum_1997 in Proj4 definition: +proj=longlat
## +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs
## OGR data source with driver: ESRI Shapefile
## Source: "D:\R\Ecological Data Analysis in R\Sample Data\20211109_Taiwan\COUNTY_MOI_1090820.shp", layer: "COUNTY_MOI_1090820"
## with 22 features
## It has 4 fields
Hot Spring Hotels
HRCT <- paste(sep = "<br/>",
"<b><a href = 'https://www.hotelroyal.com.tw/en-us/chihpen'>
Hotel Royal Chihpen </a></b>",
"Five-star hotel",
"Benian Township,Taitung County")
HRCY <- paste(sep = "<br/>",
"<b><a href = 'https://www.hotelroyal.com.tw/en-us/chiaohsi'>
Hotel Royal Chiaohsi </a></b>",
"Five-star hotel",
"Jiaoxi Township, Yilan County")
SRP <- paste(sep = "<br/>",
"<b><a href = 'https://www.facebook.com/SolasResort/'>
The Solasresort Hot Spring Hotel </a></b>",
"Three-star hotel",
"Puli Township, Nantou County",
"**(Temporarily closed)**")
OPT <- paste(sep = "<br/>",
"<b><a href = 'https://order.papawaqa.com.tw/'>
Onsen Papawaqa </a></b>",
"Four-star hotel",
"Taian Township, Miaoli County")
TYT <- paste(sep = "<br/>",
"<b><a href = 'https://www.tangyue.com.tw/'>
Tangyue </a></b>",
"Three-star hotel",
"Taian Township, Miaoli County")
RXR <- paste(sep = "<br/>",
"<b><a href = 'https://ruixiong.hlbnb.net/'>
RuiXiong HotSpring </a></b>",
"Three-star hotel",
"Ruisui Township, Hualien County")
MDC <- paste(sep = "<br/>",
"<b><a href = 'https://www.themudan.com/'>
THE MUDAN </a></b>",
"Three-star hotel",
"Checheng Township, Pingtung County")
Creat the map of Hot Spring Hotels
leaflet(Taiwan) %>%
addPolygons(weight = 0.5) %>%
addTiles(group = "Kort") %>%
addMarkers(lng = 121.00687, lat = 22.69202, popup = HRCT) %>%
addMarkers(lng = 121.75556, lat = 24.82835, popup = HRCY) %>%
addMarkers(lng = 120.99902, lat = 23.95952, popup = SRP) %>%
addMarkers(lng = 120.95186, lat = 24.46793, popup = OPT) %>%
addMarkers(lng = 120.96947, lat = 24.47009, popup = TYT) %>%
addMarkers(lng = 121.34678, lat = 23.49525, popup = RXR) %>%
addMarkers(lng = 120.74925, lat = 22.09776, popup = MDC)